<template>
  <div class="main">
    <!-- 考试模块 -->
    <div class="wrapper">
      <div class="wrapper-left">
        <router-link :to="{path: '/sequence',query:{arr:sequenceIdArr,city:city,id:cityId}}">
          <div class="seq">
            <p class="text">顺序练习</p>
            <!-- <p class="num">
              <span>0</span>/
              <span>{{len}}</span>
            </p> -->
          </div>
        </router-link>
      </div>
      <div class="wrapper-right">
        <router-link :to="{path: '/mocktest',query:{arr:mocktestIdArr,city:city,id:cityId}}">
<div class="mocktest">
            <p class="text">模拟考试</p>
          </div>
        </router-link>
          
      </div>
    </div>

    <!-- 分类 -->
    <div class="classify">
      <ul>
        <li v-for="item in classify" :key="item.id">
          <router-link :to="item.path">
 <img :src="require(`../assets/${item.img}`)" alt />
            <p>{{item.text}}</p>
          </router-link>
        </li>
      </ul>
    </div>

    <!-- 技巧 -->
    <div class="skill">
      <div class="top">
        <div class="top-left">
          <span>科目一技巧讲解</span>
        </div>
        <div class="top-right">
          <span>更多></span>
        </div>
      </div>
      <div class="bottom">
        <ul>
          <li>
            <a href>
              <div class="img-box">
                <img src="../assets/first.png" alt />
              </div>
              <p class="skill-text">只要一招，快速搞定两侧通行题</p>
            </a>
          </li>
          <li>
            <a href>
              <div class="img-box">
                <img src="../assets/first.png" alt />
              </div>
              <p class="skill-text">只要一招，快速搞定两侧通行题</p>
            </a>
          </li>
          <li>
            <a href>
              <div class="img-box">
                <img src="../assets/first.png" alt />
              </div>
              <p class="skill-text">只要一招，快速搞定两侧通行题</p>
            </a>
          </li>
          <li>
            <a href>
              <div class="img-box">
                <img src="../assets/first.png" alt />
              </div>
              <p class="skill-text">只要一招，快速搞定两侧通行题</p>
            </a>
          </li>
        </ul>
      </div>
    </div>
    <div class="up"></div>
  </div>
</template>

<script>
export default {
  props:['cityId','city'],
  data() {
    return {
      classify: [
        {path:'/',img: "king.png", text: "精选500题", id: "01" },
        {path:{path:'/random',query:{city:this.city,id:this.cityId}},img: "suiji.png", text: "随机练习", id: "02" },
        {path:'/chapterpractice',img: "lianxi2.png", text: "章节练习", id: "03" },
        {path:'/',img: "cuoti.png", text: "错题/收藏", id: "04" },
        {path:'/',img: "shijuan.png", text: "考前秘卷", id: "05" },
        {path:'/',img: "lianxi.png", text: "技巧练习", id: "06" },
        {path:'/',img: "nanti.png", text: "难题攻克", id: "07" },
        {path:'/',img: "fenlei.png", text: "交通标志", id: "08" }
      ],
      len:'',
      sequenceIdArr:'',
      mocktestIdArr:''
    };
  },
  methods: {
    getSequence() {
      fetch('https://apis.netstart.cn/driver/exercise/sequence?carType=car&course=kemu1&cityCode='+this.cityId)
      .then(response => response.json())
      .then(data =>{
        
        this.sequenceIdArr = data.questionIds
        this.len = this.sequenceIdArr.length

      })
    },
   
    getMocktest() {
      fetch('https://apis.netstart.cn/driver/exam')
      .then(response => response.json())
      .then(data =>{
        
        this.mocktestIdArr = data.questionIds

      })
    }
  },
  created() {
    // 测试是否拿到值
    this.getSequence()

    this.getMocktest()
    // console.log(this.cityId);
  }
};
</script>
<style>
.main {
  width: 100%;
}

.main .wrapper {
  width: 100%;
  height: 250px;
  display: flex;
  align-items: center;
}

.main .wrapper .wrapper-left {
  flex-basis: 50%;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.main .wrapper .wrapper-left .seq {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  background-color: #4070ff;
  text-align: center;
  color: #fff;
  line-height: 150px;
}

/* .main .wrapper .wrapper-left .seq .text {
  padding-top: 50px;
  font-size: 18px;
} */

/* .main .wrapper .wrapper-left .seq .num {
  font-size: 14px;
  margin-top: 10px;
} */

.main .wrapper .wrapper-right {
  flex-basis: 50%;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.main .wrapper .wrapper-right .mocktest {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  background-color: #ffb200;
  text-align: center;
  color: #fff;
  line-height: 150px;
}

.main .wrapper .wrapper-right .mocktest .text {
  /* padding-top: 50px; */
  font-size: 18px;
}

.main .wrapper .wrapper-right .mocktest .score {
  font-size: 14px;
  margin-top: 10px;
}

.main .classify {
  width: 100%;
  height: 220px;
  background-color: #fff;
}

.main .classify ul {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

.main .classify ul li {
  flex-basis: 23%;
  width: 100%;
  height: 50%;
}

.main .classify ul li a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  width: 100%;
  height: 100%;
}

.main .classify ul li a img {
  width: 40px;
  height: 40px;
}

.main .skill {
  width: 100%;
}

.main .skill .top {
  width: 100%;
  height: 60px;
  background-color: #fff;
  display: flex;
  line-height: 60px;
}

.main .skill .top .top-left {
  flex-basis: 50%;
  height: 100%;
  padding-left: 15px;
  font-size: 24px;
}

.main .skill .top .top-right {
  flex-basis: 50%;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: flex-end;
}

.main .skill .top .top-right span {
  padding-right: 5px;
  color: #ccc;
  font-size: 18px;
}

.main .skill .bottom {
  width: 100%;
}

.main .skill .bottom ul {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
}

.main .skill .bottom ul li {
  flex-basis: 50%;
  width: 100%;
  height: 290px;
  background-color: #fff;
}

.main .skill .bottom ul li a {
  display: flex;
  width: 100%;
  height: 100%;
  align-items: center;
  flex-direction: column;
}

.main .skill .bottom ul li a .img-box {
  width: 150px;
  height: 200px;
  overflow: hidden;
  border-radius: 10px;
}

.main .skill .bottom ul li a .img-box img {
  width: 100%;
  height: 100%;
}

.main .skill .bottom ul li a p {
  padding-left: 15px;
  font-size: 14px;
  padding-top: 10px;
}

.main .up {
  width: 100%;
  height: 50px;
}
</style>